package com.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;

@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/time")
    public Map<String, Object> getTime() {
        Map<String, Object> result = new HashMap<>();
        
        // 当前系统时间
        Date now = new Date();
        result.put("systemTime", now);
        
        // LocalDateTime
        LocalDateTime localDateTime = LocalDateTime.now();
        result.put("localDateTime", localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        
        // 当前时区
        result.put("defaultTimeZone", TimeZone.getDefault().getID());
        
        // 时间戳
        result.put("timestamp", System.currentTimeMillis());
        
        return result;
    }
} 